<?php 
function insertSubMenu($parentMenu){
	echo "<ul>";
	foreach($parentMenu as $key=>$value){
		echo "<li>";
		if($value['level_backoffice_menu']==0){
			echo "<a class=\"hide\" href=\"".$value['link_backoffice_menu']."\">";
		}
		else{
			echo "<a href=\"".$value['link_backoffice_menu']."\">";
		}
		echo $value['name_backoffice_menu'];
		echo "</a>";
		$backofficeMenu = new Model_DbTable_System_Backofficemenu();
		$subMenu = $backofficeMenu->listSubMenu($value['id_backoffice_menu']);
		//var_dump($subMenu);
		if(!empty($subMenu)){
			insertSubMenu($subMenu);			
		}
		
		echo "</li>";
	}
	echo "</ul>";
}
$backofficeMenu = new Model_DbTable_System_Backofficemenu();
$topLevelMenu = $backofficeMenu->listTopLevelMenu();

?>
<div class="menu">
<?php 
//var_dump($topLevelMenu);
insertSubMenu($topLevelMenu);
?>

<!--
<ul>
<li><a class="hide" href="#">STATUS REPORT</a>
</li>
<li><a class="hide" href="#">MANAGE USER</a>
</li>
<li><a class="hide" href="#">MANAGE TEMPLATE</a>
</li>
<li><a class="hide" href="#">MANAGE ARTICLE</a>
	<ul>
	<li><a href="#" title="Add New Section">Add Section</a></li>
	<li><a href="#" title="Manage Section">Manage Section</a></li>
    <li><a href="#" title="Add New Category">Add Category</a></li>
    <li><a href="#" title="Manage Category">Manage Category</a></li>
    <li><a href="#" title="Add New Article">Add Article</a></li>
    <li><a href="#" title="Manage Article">Manage Article</a></li>
    <li><a href="#" title="Manage Front Page Article">Manage Front Page</a></li>
    </ul>
</li>
<li><a class="hide" href="#">MANAGE MENU</a>
</li>

	<ul>
	<li><a href="../menu/zero_dollars.html" title="The zero dollar ads page">zero dollars</a></li>
	<li><a href="../menu/embed.html" title="Wrapping text around images">wrapping text</a></li>
	<li><a href="../menu/form.html" title="Styling forms">styled form</a></li>
	<li><a href="../menu/nodots.html" title="Removing active/focus borders">active focus</a></li>

	<li><a class="hide" href="../menu/hover_click.html" title="Hover/click with no active/focus borders">HOVER/CLICK &gt;</a>



		<ul>
			<li><a href="../menu/form.html" title="Styling forms">styled form</a></li>
			<li><a href="../menu/nodots.html" title="Removing active/focus borders">active focus</a></li>
			<li><a href="../menu/hover_click.html" title="Hover/click with no active/focus borders">hover/click</a></li>
		</ul>



	</li>

	<li><a href="../menu/shadow_boxing.html" title="Multi-position drop shadow">shadow boxing</a></li>
	<li><a href="../menu/old_master.html" title="Image Map for detailed information">image map</a></li>
	<li><a href="../menu/bodies.html" title="fun with background images">fun backgrounds</a></li>
	<li><a href="../menu/fade_scroll.html" title="fade-out scrolling">fade scrolling</a></li>
	<li><a href="../menu/em_images.html" title="em size images compared">em sized images</a></li>
	</ul>



-->


</ul>

</div>
